package com.hanhai.material.device.entity;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.RelationOneToMany;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 *  实体类。
 *
 * @author youchuang
 * @since 2023/10/18 11:26:03
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "sys_plc",dataSource = "device")
public class SysPlc implements Serializable {

    @Id(keyType = KeyType.Auto)
    private Integer id;

    private String name;

    private Integer errorParamNum;

    private Integer warnParamNum;

    private Integer status;

    private String imgUrl;

    private String imgUrlPc;

    private Integer isElec;

    private String regionId;

    private String projectId;

    private Date createTime;

    private String plcDeviceId;

    private String machineName;

    private String machineArea;

    private String workPlanId;

    String paramsUp;

    String paramsStatus;

    String paramsDown;

    String paramsAna;

    private double shiftNum;

    private double modeNum;

    private long averagePeriod;

    private String productRecordId;

    @RelationOneToMany(selfField = "workPlanId",targetField = "workPlanId", extraCondition = "(create_time >=:start and create_time<=:end and machine_name=:machineName)")
    public List<SysBadRecord> badRecordList;

    @RelationOneToMany(selfField = "productRecordId",targetField = "productRecordId")
    private List<Paramsup> paramsupList;

}
